\documentclass{ctexart}
\usepackage{avanti}
\everymath{\color{Solarized-magenta}}
\pagestyle{empty} % 没有页眉和页脚

\tikzset{font=\large}

% define the plot style and the axis style
\tikzset{plain/.style = {draw=none, Solarized-base01, minimum height=25, minimum width=25}}
\tikzset{base/.style={smooth, thick, Solarized-base01, draw=Solarized-base01}}

\tikzset{box/.style = {rectangle,base,minimum height=20,minimum width=30}}
\tikzset{roundbox/.style = {rounded corners,base,minimum height=20,minimum width=310}}
\tikzset{op/.style = {circle,minimum width=20,base,fill=Solarized-base2}}

\tikzset{arrow/.style={->,>=stealth,base}}

\begin{document}

\begin{tikzpicture}

    \pgfmathtruncatemacro{\xinc}{2};
    \pgfmathtruncatemacro{\yinc}{2};

    \def \xarray{{"<",20,5,10,">",20,10,5}};

    \foreach \i in {0,...,7}
        {
            \pgfmathtruncatemacro{\x}{\i-5};
            \node (a\i) [box] at (\xinc * \x, 1.2) {$\av_\i$};
            \ifthenelse{\i = 5}{
                \node (x\i) [plain] at (\xinc * \x, 0) {$\red{\pgfmathparse{\xarray[\i]}\pgfmathresult}$};
            }{
                \ifthenelse{\i = 6}{
                    \node (x\i) [plain] at (\xinc * \x, 0) {$\yellow{\pgfmathparse{\xarray[\i]}\pgfmathresult}$};
                }{
                    \ifthenelse{\i = 7}{
                        \node (x\i) [plain] at (\xinc * \x, 0) {$\blue{\pgfmathparse{\xarray[\i]}\pgfmathresult}$};

                    }
                    {
                        \node (x\i) [plain] at (\xinc * \x, 0) {$\pgfmathparse{\xarray[\i]}\pgfmathresult$};
                    }
                }
            }

            \draw [arrow] (x\i) -- (a\i);

            \ifthenelse{\i > 0}{
                \pgfmathtruncatemacro{\im}{\i-1};
                \draw [arrow] (a\im) -- (a\i);
            }{;}
        }

    \draw [arrow,Solarized-red] (a4) -- ++(0,0.8) -- node [midway,draw=none,below] {$\red{1}$} ++(-\xinc*3,0) -- (a1);
    \draw [arrow,Solarized-yellow] (a5) -- ++(0,1.4) -- node [midway,draw=none,below] {$\yellow{3}$} ++(-\xinc*2,0) -- (a3);
    \draw [arrow,Solarized-blue] (a6) -- ++(0,2.0) -- node [midway,draw=none,below] {$\blue{2}$} ++(-\xinc*4,0) -- (a2);
    \draw [arrow] (a7) -- ++(0,2.6) -- ++(-\xinc*7,0) -- (a0);

    \draw [base] (x0) -- ++(0,-0.5) -- node [midway,draw=none,below] {编码器} ++(\xinc*3,0) -- (x3);
    \draw [base] (x4) -- ++(0,-0.5) -- node [midway,draw=none,below] {解码器} ++(\xinc*3,0) -- (x7);

\end{tikzpicture}




\end{document}

